<style scoped lang="less">
</style>
<template>
	<div class="threshold">
		<el-table 
			:data="dataList" 
			style="width: 100%"
			v-loading="loading">
		    <el-table-column type="index" width="50" label="序号"></el-table-column>
		    <el-table-column prop="number" label="设备编号"></el-table-column>
		    <el-table-column prop="name" label="文件名称"></el-table-column>
		    <el-table-column prop="createtime" label="创建时间"></el-table-column>
		    <el-table-column label="操作" width="100">
                <template slot-scope="scope">
                    <el-button type="primary" @click="downloadAction(scope.row)">下载</el-button>
                </template>
            </el-table-column>
		</el-table>
        <el-pagination
            v-if="total>0"
            class="text-right mt-20 mr-20"
            @current-change="handleCurrentChange"
            :current-page="currentPage"
            :page-size="pageSize"
            layout="prev, pager, next, total, jumper"
            :total="total">
        </el-pagination>
	</div>
</template>
<script>
export default {
	name: 'iotBlk',
	props: {
		number: {
			type: String,
			default: ''
		}
	},
	computed: {},
	watch: {},
	data () {
		return {
            loading: false,
            pageSize:10,
            currentPage:1,
            total:0,
            dataList: []
		}
	},
	methods: {
		getData (page) {
            page = page || 1
            this.$get('/fireFightingIOT/device/getChainOfEvidencePageList', {
                number: this.number,
                page: page,
			    limit: this.pageSize,
            }).then(res => {
                let data = res.data
            	this.loading = false
                this.dataList = data.Items
                this.currentPage = page
                this.total = data.totalSize
            }, (err) =>{
            	this.loading = false
				if(err.msg){
					this.$message.error(err.msg);
				}
            })
        },
        downloadAction(item){
            window.open(item.path)
        }
	},
	created () {
		this.getData()
	},
}
</script>